/*@ File Name : land.h
  @ Date : 18/11/2011
  @ Author : Guillaume Collombet, Ulysse Mensa, Sylvain Chambe

Fireworks simulation projet
Copyright (C) 2011 Guillaume Collombet, Ulysse Mensa, Sylvain Chambe

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

You can contact us by sending mail at fireworks-simulation-project@googlecode.com*/

#if !defined(_LAND_H)
#define _LAND_H

#ifdef _WIN32
	#include <Windows.h>
#endif

#include <GL/glew.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>

#include <malloc.h>
#define _USE_MATH_DEFINES
#include <math.h>

#include "const.h"
#include "opengl.h"
#include "texture.h"
#include "grass.h"
#include "camera.h"
#include "displaylist.h"
#include "dynamicarray.h"
#include "vertexobjectbuffer.h"
#include "sprite.h"

#define LAND_HEIGHTMAP_TEXTURE_FILENAME "terrain.bmp"
#define LAND_TEXTURE_FILENAME "terrain_tex_tmp.png"

struct s_Land
{
	float* heightmap;
	int heightmapWidht;
	int heightmapHeigth;
	float landBox[3];
	float lightPosition[3];
	float waterLevel;
} typedef Land;

static SDL_Surface* heightmapTex;
static GLuint landTex;
static int width, height;
static VBO vbo;
static Grass* grass;
static GLuint waterTex;

void Land_Init(const char heightmapFilename[], const char textureFilename[]);
void Land_Draw(const Camera* camera, float elapsed);
void Land_Destoy();

#endif  /*_LAND_H*/
